package answercard;

import org.opencv.core.Rect;

public class RectComp implements Comparable<Object>{

    Rect rm;

    public RectComp(Rect rms) {
        super();
        this.rm = rms;
    }


    public Rect getRm() {
        return rm;
    }


    public void setRm(Rect rm) {
        this.rm = rm;
    }


    public boolean operator(RectComp ti) {
        return rm.x < ti.rm.x;
    }

    @Override
    // 按面积排序，最大的放第一个
    public int compareTo(Object object) {
        if(this == object){
            return 0;
        } else if (object instanceof RectComp) {
            RectComp rect = (RectComp) object;
            if (rm.y > rect.rm.y){
                return 1;
            }else {
                return -1;
            }
        } else {
            return -1;
        }
    }

}
